package gui;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

import control.*;
import model.*;


public class MainMenu extends JFrame {

	private JPanel contentPane;
	private static ProductMenu productM = new ProductMenu();
	private static CustomerMenu customerM = new CustomerMenu();
	private static SaleMenu salesM = new SaleMenu();

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MainMenu frame = new MainMenu();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public MainMenu() 
	{
		setTitle("Main Menu");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 640, 350);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JButton customerUI = new JButton("Customer Menu");
		customerUI.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				customerM.setVisible(true);
			}
		});
		
		customerUI.setBounds(220, 30, 200, 40);
		contentPane.add(customerUI);
		
		JButton productUI = new JButton("Product Menu");
		productUI.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				productM.setVisible(true);
				productM.updateSupplierTable();
			}
		});
		productUI.setBounds(220, 80, 200, 40);
		contentPane.add(productUI);
		
		JButton saleUI = new JButton("Sale Menu");
		saleUI.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				salesM.setVisible(true);
			}
		});
		saleUI.setBounds(220, 129, 200, 40);
		contentPane.add(saleUI);
		
		JButton leaseUI = new JButton("Lease Menu");
		leaseUI.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				

			}
		});
		leaseUI.setBounds(220, 180, 200, 40);
		contentPane.add(leaseUI);
		
		JButton invoiceUI = new JButton("Invoice Menu");
		invoiceUI.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				

			}
		});
		invoiceUI.setBounds(220, 230, 200, 40);
		contentPane.add(invoiceUI);
		
		JButton quit = new JButton("Quit");
		quit.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.exit(EXIT_ON_CLOSE);
			}
		});
		quit.setBounds(510, 270, 90, 25);
		contentPane.add(quit);
	}
}